//
//  WRYStatusWindow.m
//  BaiSiBuJie
//
//  Created by wry on 16/5/9.
//  Copyright © 2016年 WRY. All rights reserved.
//

#import "WRYStatusWindow.h"

UIWindow * _statusWindow;//

@implementation WRYStatusWindow

+(void)show
{
    UIApplication *application=[UIApplication sharedApplication];
    UIWindow * statusWindow=[[self alloc]initWithFrame:application.statusBarFrame];

    statusWindow.backgroundColor=[UIColor clearColor];
    statusWindow.windowLevel=UIWindowLevelAlert;
    statusWindow.hidden=NO;
    statusWindow.rootViewController=[[UIViewController alloc]init];
    _statusWindow=statusWindow;
    statusWindow.userInteractionEnabled=YES;

}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
     UIWindow * statusW= [UIApplication sharedApplication].keyWindow;
    // 获取一个控件中所有子控件
    [self getChildView:statusW];
}

-(void)getChildView:(UIView*)view
{
    // 1.遍历主窗口的所有子控件 递归
    for (UIView *childview in view.subviews) {
        if ([childview isKindOfClass:[UITableView class]]) {
            UITableView *tableV=(UITableView *)childview;
            [tableV setContentOffset:CGPointMake(0, -tableV.contentInset.top) animated:YES];
        }

        [self  getChildView:childview];
    }
}


@end
